package com.ruoyi.quartz.task;

import com.ruoyi.system.client.SteamDTApiClientService;
import com.ruoyi.system.client.impl.CsQaqApiClientServiceImpl;
import com.ruoyi.system.domain.steamDt.BatchPlatformPriceVO;
import com.ruoyi.system.service.ICsInventoryService;
import com.ruoyi.system.service.ICsOrnamentNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;

import java.util.Arrays;
import java.util.List;

/**
 * 定时任务调度测试
 *
 * @author ruoyi
 */
@Component("ryTask")
public class RyTask {
    @Autowired
    private ICsInventoryService csInventoryService;

    @Autowired
    private ICsOrnamentNameService csOrnamentNameService;

    @Autowired
    private SteamDTApiClientService steamDTApiClientService;
    @Autowired
    private CsQaqApiClientServiceImpl csQaqApiClientServiceImpl;

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params) {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams() {
        csQaqApiClientServiceImpl.updateOrnamentNames();
    }

    public void refreshAvailableQuantity() {
        csInventoryService.refreshAvailableQuantity();
    }

    // 刷新 SteamDt 库中的饰品基础信息 每天一次
    public void refreshCsBaseInfoBySteamDt() {
        csOrnamentNameService.refreshCsBaseInfoBySteamDt();
    }

    // 批量获取平台价格并更新到库存中 每分钟一次
    public void refreshPlatformPriceBySteamDT() {
        csInventoryService.refreshPlatformPriceBySteamDT();
    }


    // 批量获取平台价格并更新到库存中 每分钟一次
    public void refreshCsOrnamentNamePlatformPriceBySteamDT() {
        csOrnamentNameService.refreshCsOrnamentNamePlatformPriceBySteamDT();
    }

    // 获取csqaq饰品异动
    public void getAbnormalMovementByCsQaq() {
        csOrnamentNameService.getAbnormalMovementByCsQaq();
    }


    public void getBatchPriceRestTemplateByMarketHashNames() {
        List<BatchPlatformPriceVO> batchPriceRestTemplateByMarketHashNames = steamDTApiClientService.getBatchPriceRestTemplateByMarketHashNames(
                Arrays.asList("Knife | Slaughter (Field-Tested)", "AWP | CMYK (Factory New)"));
        System.out.println(batchPriceRestTemplateByMarketHashNames);
    }

}
